
import { Navigate, useRoutes } from "react-router-dom";
import Login from '@/pages/login/login'
import Layout from "@/layout/index"
import Order from "@/pages/dataManage/order/order"
import Month from "@/pages/dataManage/month/month"
import Account from "@/pages/user/account/account"
import Intelligent from "@/pages/distribution/intelligent/intelligent"
import Base from "@/pages/dataManage/base/base"
import Plan from "@/pages/distribution/plan/plan"
import Amount from "@/pages/distribution/amount/amount"

export const partRouter = [
    {

        title: '用户管理',
        element: <Layout />,
        icon: "UserOutlined",
        meta: {

        },
        children: [
            {
                path: '/user/account',
                title: '账号管理',
                element: <Account />,
                meta: {
                }
            },

        ]
    },
    {

        title: '数据管理',
        element: <Layout />,
        icon: "MenuOutlined",
        meta: {

        },
        children: [
            {
                path: '/dataManage/order',
                title: '订单表',
                element: <Order />,
                meta: {
                }
            },
            {
                path: '/dataManage/month',
                title: '月度需求表',
                element: <Month />,
                meta: {
                }
            },
            {
                path: '/dataManage/base',
                title: '基础配置',
                element: <Base />,
                meta: {
                }
            }
        ]
    },
    {

        title: '配送管理',
        element: <Layout />,
        icon: "CarOutlined",
        meta: {

        },
        children: [
            {
                path: '/distribution/intelligent',
                title: '智能配送',
                element: <Intelligent />,
                meta: {
                }
            },
            {
                path: '/distribution/plan',
                title: '方案确认',
                element: <Plan />,
                meta: {
                }
            },
            {
                path: '/distribution/amount',
                title: '余量管理',
                element: <Amount />,
                meta: {
                }
            },

        ]
    },

]
export const openRouter = [
    {
        path: "/",
        element: <Navigate to="/login" />
    },
    {
        path: "/login",
        element: <Login />,
        meta: {
            // title: "登录页",
            key: "login"
        }
    },
]
export const allRouter = [
    ...openRouter,
    ...partRouter
]

const Router = () => {
    const routes = useRoutes(allRouter);
    return routes;
};

export default Router;     //导出所有路由





